package com.neuedu.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 金山
 * 项目：sca-all-in-one
 * site: https://blog.fulfill.com.cn
 * 描述
 * @data 2025/6/311:01
 */
@SpringBootApplication
@RestController
@RefreshScope
public class ConfigApp {


    // 获取 application.properties 或者是 application.yaml中的属性
    @Value("${myname}")
    private String myname;

    @Value("${name}")
    private String name;

    @Value("${age}")
    private Integer age;


    public static void main(String[] args) {
        SpringApplication.run(ConfigApp.class, args);
    }

    /**
     * http://127.0.0.1:8080/
     *
     * @return
     */
    @RequestMapping("/")
    public String hello() {

        return "helloworld: myname=" + myname;
    }

    @RequestMapping("/getNacosConfig")
    public String getNacosConfig() {

        return String.format("name:%s , age: %d", name, age);
    }


}
